PRequestBuf

Manages a parameter block used as part of a command or query. It allocates a memory block using the PageMaker memory functions, and then deletes the block when the PRequestBuf object is destroyed.


constructor

PRequestBuf(size_t size);
The constructor will attempt to allocate a block of memory of the specified size. If the memory cannot be allocated, a general CQ_FAILURE exception is thrown.
PRequestBuf(void * h);
The constructor assumes that the memory block was already allocated before the constructor was called. The memory block passed in must have been allocated with PageMaker's memory calls, because the destructor will delete the block using these calls.

Member functions

~PRequestBuf();
The destructor frees the memory used by the PRequestBuf. It assumes that the memory was allocated with PageMaker's memory functions.

The PRequestBuf class overloads several operator<<() functions. These are used to copy values into the PRequestbuf object, using a similar syntax to an ostream object.

PRequestBuf& operator<< (short aShort);
PRequestBuf& operator<< (unsigned short aShort);
PRequestBuf& operator<< (long aLong);
PRequestBuf& operator<< (unsigned long aLong);
PRequestBuf& operator<< (const char * aString);
// C string
PRequestBuf& operator<< (const unsigned const char * aString);
// Pascal string
PRequestBuf& operator<< (PRequestBuf& aBuf);
// Append a buffer

operator const char *(); const { return bufPtr; }

Returns the PRequestBuf object as if it were a string.
size_t Size() const { return (long) curCh - (long) bufPtr; }
Returns how many bytes have been copied to the request buffer.

Member fields

PMHandle bufHdl;
The request buffer handle.
const char * curCh;
Pointer to the current character. The operator<< functions use this to copy to.
const char * bufPtr;
A dererenced pointer to bufHdl.

Not all command and query objects need to use a PRequestBuf object. Commands and queries that have no parameters, or that have only a single 16-bit or 32-bit parameter, do not need a PRequestBuf object.

A PRequestBuf object is normally used inside a high level command or query object's constructor. For an example, refer to PFind.


See also

The PReplyBuf low level class.


Copyright © 1996, Adobe Systems Incorporated. All rights reserved.

Comments or suggestions? Contact Adobe Developer Support